using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace SellProductsForm
{
    class TSell
    {
        UTLDB.UTLDB _cn = new UTLDB.UTLDB();
        public DataTable LoadProduct(string barcode) {

            DataTable data = new DataTable();
            data = _cn.GetDataByStoredProcedure("sp_SelecttblProduct",
               new string[] { "@Barcode" },
               new object[] { barcode }
                );
            return data;

        }

        public DataTable SelectSeedByProduct(int idPro)
        {
            DataTable data = _cn.GetDataByStoredProcedure("sp_SelecttblSeed_byProduct",
                         new string[] { "@idPro" },
                         new object[] { idPro });
            return data;
        }

        public int InsertTally( infoTally_out info )  {

            int id = _cn.ExecuteInsert("sp_InserttblTally-out",
              new string[] { "@DateCreate", "@MemberID", "@CustomerID", "@MoneySum", "@NumberProduct","@Active" },
              new object[] { info.DateCreate, info.MemberID, info.CustomerID, info.MoneySum, info.NumberProduct, info.Active });
            return id;
        
        }
          public int InsertDetailTally( infoDetailTally info )  {
            int id = _cn.ExecuteInsert("sp_InserttblDetailTally-out",
              new string[] { "@TallyoutID", "@Barcode", "@Price", "@Active" },
              new object[] { info.TallyOutid, info.Barcode, info.Price, info.Active});
            return id;
        
        }
          public void UpdateProduct(string id, int status) {
              _cn.ExecuteNonQuery("sp_UpdateStatictblProduct",
                  new string[] { "@Barcode", "@Status" },
                  new object[] {id, status});
          }

    }
}
